﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using Org.Eurekaa.DNJ.Settings;

namespace Org.Eurekaa.DNJ.UI.DNJSettings
{
    [Serializable()]
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public class DNJAjaxSettings : GenericSettingsObject
    {
        [Description("By default, all requests are sent asynchronous (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active.")]
        [DefaultValue(true), NotifyParentProperty(true), RefreshProperties(RefreshProperties.Repaint)]
        public bool Async
        {
            get { return this.Get<bool>("async"); }
            set { this["async"] = value; }
        }

        [Description("if set to false it will force the pages that you request to not be cached by the browser.")]
        [DefaultValue(true), NotifyParentProperty(true), RefreshProperties(RefreshProperties.Repaint)]
        public bool Cache
        {
            get { return this.Get<bool>("cache"); }
            set { this["cache"] = value; }
        }


        [Description("The type of request to make (POST or GET), default is GET. Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.")]
        [DefaultValue("GET"), NotifyParentProperty(true), RefreshProperties(RefreshProperties.Repaint)]
        public string Type
        {
            get { return this.Get<string>("type"); }
            set { this["type"] = value; }
        }

        [Description("A username to be used in response to an HTTP access authentication request.")]
        [DefaultValue(""), NotifyParentProperty(true), RefreshProperties(RefreshProperties.Repaint)]
        public string Username
        {
            get { return this.Get<string>("username"); }
            set { this["username"] = value; }
        }
    }
}
